﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace IGIS
{
    public class SearchConfiguratorController : ApiController
    {
        // GET api/<controller>
        public List<TBL_SearchConfigurator>Get()
        {


            using (HetzEntities db = new HetzEntities())
            {
               
                      var query = from p in db.TBL_SearchConfigurator
                                orderby p.TableHebName ascending
                         select p;
                return query.ToList<TBL_SearchConfigurator>();
            }
            
        }

        // GET api/<controller>/5
        public TBL_Project Get(decimal id)
        {
            using (HetzEntities db =new HetzEntities())
            {
              return  db.TBL_Project.FirstOrDefault(x => x.PolygonID == id);
                
            }
        
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public List<TBL_Project>  Put(string SelectedFilter1,string  SelectedFilter2,string  SelectedFilter3,
           string SelectedFilter1val, string SelectedFilter2val, string SelectedFilter3val, string SelectedDrpSearchBy)
        {

            /*if (!_customers.Update(TBL_Project))
                throw new HttpResponseException(HttpStatusCode.NotFound);*/
            
                using (HetzEntities db = new HetzEntities())
                {
                    var query = from p in db.TBL_Project
                               
                                select p;
                    //db.Entry(polygon).State = EntityState.Modified;
                    //db.SaveChanges();
                    return query.ToList<TBL_Project>();

                }
                //   return customer;
              
           

        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
    }
}